package com.jy.rhin.infra.repo.document.submission.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jy.rhin.domain.document.submission.entity.DocumentSubmissionDO;
import com.jy.rhin.infra.repo.document.submission.assembler.RhinCodeableAssembler;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author dhl
 */
@Data
@NoArgsConstructor
@TableName("t_document_submission_set")
public class DocumentSubmissionSetPO {

    public DocumentSubmissionSetPO(DocumentSubmissionDO submissionDO) {
        this.id = submissionDO.getId();
        this.createTime = submissionDO.getCreateTime();
        this.sourceId = submissionDO.getSourceId();
        this.uniqueId = submissionDO.getUniqueId();
        this.submissionTime = submissionDO.getSubmissionTime();
        this.homeCommunityId = submissionDO.getHomeCommunityId();
        this.jsonText = submissionDO.getJsonText();
        this.contentTypeCode = RhinCodeableAssembler.getCodeText(DocumentSubmissionDO::getContentTypeCode, submissionDO);
    }

    @TableId
    private Long id;
    /**
     * 文档管理域标识
     */
    @TableField("home_community_id")
    private String homeCommunityId;
    /**
     * 文档源标识符;用于确定该提交集由哪一个系统提交
     */
    @TableField("source_id")
    private String sourceId;
    /**
     * 唯一标识符
     */
    @TableField("unique_id")
    private String uniqueId;
    /**
     * 提交时间
     */
    @TableField("submission_time")
    private Date submissionTime;
    /**
     * 提交集json串
     */
    @TableField("json_text")
    private String jsonText;
    /**
     * 文档内容类型
     */
    @TableField("content_type_code")
    private String contentTypeCode;
    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;


}
